package dao;

import java.sql.Connection;
import java.sql.DriverManager;

public class PersistConexao {

	private java.sql.Connection conexao;

	public Connection openConecao(String schema, String user, String pass) {

		try {

			Class.forName("org.gjt.mm.mysql.Driver");
			// conexao =
			// DriverManager.getConnection("jdbc:mysql://localhost:3306/db_plcsistemas","root","mysql");
			conexao = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/" + schema, user, pass);

		} catch (Exception e) {
			e.printStackTrace();
		}

		return conexao;
	}

	public void closeConexao() {

		try {

			conexao.close();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
